#include "treeviewdelegate.h"

TreeViewDelegate::TreeViewDelegate(QObject *parent) :
    QStyledItemDelegate(parent)
{

}

void TreeViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QStyledItemDelegate::paint(painter,option,index);
    int x,y,w,h;
    option.rect.getRect(&x, &y, &w, &h);

    QPen pen;
    pen.setWidth(1);
    pen.setColor(QColor(220, 220, 220));
    painter->setPen(pen);
    painter->drawLine(QPointF(x,y), QPointF(x+w, y));

    if (index.column() != 0) {
        pen.setWidth(1);
        pen.setColor(QColor(150, 150, 150));
        painter->setPen(pen);
        painter->drawLine(QPointF(x,y), QPointF(x, y+h));
    }
}
